<div class="container" ng-if="state ==='loading'">
    <div class="page-header">
        <h1>数据加载中......ヾ(ｏ･ω･)ﾉ</h1>
    </div>
</div>
<div class="container" ng-if="state === 'error'">
    <div class="page-header">
        <h1>加载失败啦ミﾟДﾟ彡,刷新下页面试试</h1>
    </div>
</div>
<div class="row" ng-if="state === 'finished'">
    <div class="col-xs-4">
        <h3 class="page-header">待录入考勤号的团队</h3>
        <div class="row">
            <div class="list-group" id="team-list">
                <a class="list-group-item"
                   ng-class="{active:currentTeam === team}"
                   href=""
                   ng-repeat="team in teams track by $index" ng-click="selectTeam(team)">{{team.teamName}}
                </a>
            </div>
        </div>
        <div class="row text-center">
            <button class="btn btn-primary btn-lg btn-block"
                    ng-click="checkAndSubmit()"
                    ng-class="{disabled:attendanceNumberForm.$invalid || !currentTeam}">提交</button>
        </div>
    </div>
    <div class="col-xs-8">
        <h3 class="page-header">团队成员</h3>
        <form name="attendanceNumberForm">
        <table class="table table-striped">
            <thead>
            <tr>
                <td>姓名</td>
                <td>学号</td>
                <td>考勤号</td>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="member in currentTeam.members track by $index">
                <td><span ng-bind="member.studentName"></span></td>
                <td><span ng-bind="member.studentId"></span></td>
                <td>
                    <input name="attendanceNumber{{member.studentId}}"
                           type="text" class="form-horizontal form-control"
                           ng-model="member.attendanceNumber"
                           required
                           ng-disabled="member.isAttendanceNumberExists"
                           ng-pattern="/^\d+$/"
                    />
                    <span ng-show="attendanceNumberForm['attendanceNumber' + member.studentId].$error.required" class="text-danger">*考勤号未填写</span>
                    <span ng-show="attendanceNumberForm['attendanceNumber' + member.studentId].$error.pattern" class="text-danger">*考勤号只能是数字的组合</span>
                </td>
            </tr>
            </tbody>
        </table>
        </form>
    </div>
</div>